package com.itheima.health.controller;

import com.itheima.health.entity.Result;
import com.itheima.health.service.SetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("setmeal")
@Api(tags = "移动端套餐管理")
public class SetmealController {

    @Reference
    private SetmealService setmealService;

    @GetMapping("findSetmealInfoById/{id}")
    public Result findSetmealInfoById(@PathVariable("id") Integer id) {
        return new Result(setmealService.findSetmealInfoById(id));
    }

    //处理findAllSetmeal业务
    @GetMapping("findAllSetmeal")
    @ApiOperation(value = "查询所有套餐", notes = "根据客户端请求，完成查询所有套餐")//   添加业务方法上
    public Result findAllSetmeal() {
        return new Result(setmealService.findAllSetmeal());
    }

    @GetMapping("findSetmealDetailById/{id}")
    @ApiOperation(value = "查询套餐详细信息", notes = "根据客户端的ID，查询套餐详细信息")//   添加业务方法上
    public Result findSetmealDetailById(@PathVariable("id") Integer id) {
        return new Result(setmealService.findSetmealDetailById(id));
    }


}
